-
Notifications
You must be signed in to change notification settings - Fork 1.1k
om2: MetricFamilyName is MetricName #2791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I am bit surprised but I couldn't find any special rule for those suffixes in the ABNF to change... also tests passes despite me adding suffixes to MF names. Something smells like ABNF is too relaxed. |
ArthurSens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could review only half of the PR 😬, I have some small comments
| The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_total" as a counter called "foo" could create a "foo_total" in the text format. | ||
| Names SHOULD be in snake_case. Names SHOULD follow the restrictions in the ABNF section under `metricname`. Metric names MAY be any quoted and escaped UTF-8 string as described in the ABNF section. Be aware that exposing UTF-8 metrics is still experimental and may reduce usability, especially when `_total` or unit suffixes are not included. | ||
|
|
||
| Colons in MetricFamily names are RESERVED to signal that the MetricFamily is the result of a calculation or aggregation of a general purpose monitoring system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this holds any value in the spec. When we mention 'RESERVED', are we instructing SDKs not to allow colons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't know what RESERVED means? I don't think it is one of the keywords (like MUST, SHOULD, MUST NOT).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can say "MUST NOT be used unless ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep RESERVED as it was there before my change. We use RESERVED word 6 times already in this document, so let's have a dedicated PR to change it.
I think it's fine, but to be strict with https://datatracker.ietf.org/doc/html/rfc2119 we could check MUST NOT.
Let's focus on suffixes in this PR, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats also fine by me
|
do we still intend to merge this? |
11a31fa to
ff36b8d
Compare
|
I think so. Much simpler now with Composite Types merged in. |
|
PTAL @krajorama @dashpole @ywwg |
|
|
||
| * [Histogram](#histogram) MetricFamily Type. | ||
| * [GaugeHistogram](#gauge-histogram) MetricFamily Type. | ||
| * [GaugeHistogram](#gaugehistogram) MetricFamily Type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Broken link
| or dropped data. | ||
|
|
||
| The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_total" as a counter called "foo" could create a "foo_total" in the text format. | ||
| Exposers MUST avoid names that could conflict with the Text OpenMetrics 1.0 [histogram](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#histogram-1), [gaugehistogram](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#gaugehistogram-1) and [summary](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#summary-1) suffixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to put it is that gauges, counters, stateset names MUST NOT end with _count, _sum, _gcount, _gsum, _bucket - kind of simple rule. Would that be more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just simplify further:
MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket.
It's true for anything except Histograms and Gauge Histograms , including Summary since that has series without magic suffixes. But I don't think it's worth making an exception for Histograms, Gauge Histograms. Especially because I don't think people will actually follow this unless SDKs prohibit it and I think we need to add a line about ingestors:
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally good point, but especially _count might be common as a standalone gauge or even counter. This line would prohibit for compatibility reason (so tmp time) and actually is not needed if the same target does NOT expose <metric without _count_but_histogram>.
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
Again, if this needs to be stronger that we need to move MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket. to SHOULD NOT.
Every "must" MAY be accepted by some implementations, no?
I proposed SHOULD NOT for wide rule, and MUST NOT for collision explanation - framed as "OpenMetrics 2 converted to OpenMetrics 1 or Prom TEXT should not cause collisions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with SHOULD NOT. MUST NOT presumably means that we place more of a burden on clients exposing the metrics to ensure it doesn't happen (like suffixes in OM 1.0). We either would fail scrapes with bad suffixes, or we would have to "fix" names by modifying them to make them valid (which we sometimes did for OM 1.0).
| or dropped data. | ||
|
|
||
| The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_total" as a counter called "foo" could create a "foo_total" in the text format. | ||
| Exposers MUST avoid names that could conflict with the Text OpenMetrics 1.0 [histogram](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#histogram-1), [gaugehistogram](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#gaugehistogram-1) and [summary](https://github.com/prometheus/docs/blob/main/docs/specs/om/open_metrics_spec.md#summary-1) suffixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just simplify further:
MetricFamily name MUST NOT end with _count, _sum, _gcount, _gsum, _bucket.
It's true for anything except Histograms and Gauge Histograms , including Summary since that has series without magic suffixes. But I don't think it's worth making an exception for Histograms, Gauge Histograms. Especially because I don't think people will actually follow this unless SDKs prohibit it and I think we need to add a line about ingestors:
Ingestors MAY accept non compliant MetricFamily names and only error out when a naming clash occurs.
Fixes prometheus/OpenMetrics#305 Signed-off-by: bwplotka <bwplotka@gmail.com>
ff36b8d to
70aa8d3
Compare
|
|
||
| The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_total" as a counter called "foo" could create a "foo_total" in the text format. | ||
| MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically name MUST NOT create | ||
| MetricName collision when converted to [the Text OpenMetrics 1.0](https://prometheus.io/docs/specs/om/open_metrics_spec). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - are we manually word-wrapping or no? Other paragraphs seem not to have newlines mid-paragraph. The markdown format doesn't care but we might as well be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to, will revert. We could use autoformatter too to remove those if we want
| ###### Reserved Suffixes | ||
|
|
||
| The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_total" as a counter called "foo" could create a "foo_total" in the text format. | ||
| MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically name MUST NOT create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically name MUST NOT create | |
| MetricFamily name SHOULD NOT end with `_count`, `_sum`, `_gcount`, `_gsum`, `_bucket`. Specifically a name MUST NOT create a MetricName collision when converted to [the Text OpenMetrics 1.0](https://prometheus.io/docs/specs/om/open_metrics_spec). |
| * Gauge: `` (empty) | ||
| * StateSet: `` (empty) | ||
| * Unknown: `` (empty) | ||
| > This rule is because this specification is following a shift in Prometheus ecosystem towards [composite values](#compositevalues) instead of [the "classic" representation](https://prometheus.io/docs/specs/om/open_metrics_spec/#histogram-1). However, this transformation will take time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| > This rule is because this specification is following a shift in Prometheus ecosystem towards [composite values](#compositevalues) instead of [the "classic" representation](https://prometheus.io/docs/specs/om/open_metrics_spec/#histogram-1). However, this transformation will take time. | |
| > This rule exists because this specification is following a shift in Prometheus ecosystem towards [composite values](#compositevalues) instead of [the "classic" representation](https://prometheus.io/docs/specs/om/open_metrics_spec/#histogram-1). However, this transformation will take time. |
| A non-compliant example would be a gauge called `foo_bucket` and a histogram called `foo`. Exposers negotiating the older | ||
| OpenMetrics or Text formats, or ingestors which support only the older data model could end up storing `foo` histogram | ||
| in a classic representation (`foo_bucket`, `foo_count`, `foo_sum`) causing clash with the gauge and scrape rejection or dropped data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| A non-compliant example would be a gauge called `foo_bucket` and a histogram called `foo`. Exposers negotiating the older | |
| OpenMetrics or Text formats, or ingestors which support only the older data model could end up storing `foo` histogram | |
| in a classic representation (`foo_bucket`, `foo_count`, `foo_sum`) causing clash with the gauge and scrape rejection or dropped data. | |
| A non-compliant example would be a gauge called `foo_bucket` and a histogram called `foo`. Exposers negotiating the older OpenMetrics or Text formats, or ingestors which support only the older data model could end up storing the `foo` histogram in the classic representation (`foo_bucket`, `foo_count`, `foo_sum`), which would clash with the gauge and cause a scrape rejection or dropped data. |
Fixes prometheus/OpenMetrics#305
We can either merge this with TODOs before complex values/types or wait for complex type/values.